<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>javascript</title>
</head>
<style>
	
	#up{
		cursor: pointer;
	}
	input[type=submit]{
		background: #fff;
		border:1px solid #ccc;
	}
</style>
<body>
	<a href="javascript:" id="aid">百度</a>
	<!--如果a连接是javascript: 则a连接不会跳转，如果有跳转，跳转可能放到js中了-->
</body>
<script>
	
	
	aidobj=document.getElementById('aid');
	x=5;
	aidobj.onclick=function(){
		if(x<3){
			return false;//停止跳转到百度
		}else{
			location='http://www.baidu.com';
			//this.href='http://www.baidu.com';
		}
		//alert(1);
			
	}


</script>
</html>